package com.ruoyi.web.util;

import com.ruoyi.web.entity.enums.ComplainSourceEnum;
import com.ruoyi.web.entity.enums.GuangdongCityEnum;

public class EnumUtil {
    
    /**
     * 根据code获取投诉来源描述
     */
    public static String getComplainSourceDesc(String code) {
        for (ComplainSourceEnum source : ComplainSourceEnum.values()) {
            if (source.getCode().equals(code)) {
                return source.getDesc();
            }
        }
        return null;
    }

    /**
     * 根据code获取城市名称
     */
    public static String getCityName(String code) {
        for (GuangdongCityEnum city : GuangdongCityEnum.values()) {
            if (city.getCode().equals(code)) {
                return city.getName();
            }
        }
        return null;
    }

    /**
     * 验证投诉来源code是否有效
     */
    public static boolean isValidComplainSource(String code) {
        for (ComplainSourceEnum source : ComplainSourceEnum.values()) {
            if (source.getCode().equals(code)) {
                return true;
            }
        }
        return false;
    }

    /**
     * 验证城市code是否有效
     */
    public static boolean isValidCity(String code) {
        for (GuangdongCityEnum city : GuangdongCityEnum.values()) {
            if (city.getCode().equals(code)) {
                return true;
            }
        }
        return false;
    }
} 